package com.springboot.blog.controller;

import com.alibaba.fastjson.JSONObject;
import com.springboot.blog.beans.AllRole;
import com.springboot.blog.dao.AllRoleDao;
import com.springboot.blog.dao.UrsDao;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/admin")
public class AllRoleController {

    @Resource
    private AllRoleDao allRoleDao;
    @Resource
    private UrsDao ursDao;

    @RequestMapping("allRoleList")
    public String ad(){
        List<AllRole> allRole = allRoleDao.findAllRole();
        Integer count = ursDao.selectCount(null);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("code",0);
        jsonObject.put("count",count);
        jsonObject.put("data",allRole);
        return jsonObject.toString();
    }
}
